{%extends 'center.html'%}
{%block head%}
<script>

$(function () {
    $('.order_goods_list').each(function () {
    price = $(this).children('.col02').find('span').text();
{#    price = parseFloat($(this).children('.col02').find('span').text());#}
    //alert(price)
    count = parseInt($(this).children('.col03').text());
    prices = price*count;
        $(this).children('.col04').text(prices.toFixed(2)+ '元')

})

})

</script>
{%endblock head%}

{%block content_div%}

		<div class="right_content clearfix">
				<h3 class="common_title2">全部订单</h3>
        {%if pages.count > 0%}
            {% for g in pages %}
				<ul class="order_list_th w978 clearfix">
					<li class="col01">{{ g.odate }}</li>
					<li class="col02">订单号：{{ g.oid }}</li>
					<li class="col02 stress">
                        {% if g.isPay %}已支付
                        {% else %}末支付
                        {% endif %}
                    </li>
				</ul>

				<table class="order_list_table w980">
					<tbody>
						<tr>
							<td width="55%">
                                {% for p in g.orderdetailinfo_set.all %}
								<ul class="order_goods_list clearfix">					
									<li class="col01"><img src="/static/{{ p.goods.gpic }}"></li>
									<li class="col02">{{ p.goods.gtitle }}<em><span>{{ p.goods.gprice }}</span>元/{{ p.goods.gunit }}</em></li>
									<li class="col03">{{ p.count }}</li>
									<li class="col04">25.8元</li>
								</ul>
								{% endfor %}
							</td>
							<td width="15%">{{ g.ototal }}元</td>
                            {% if g.isPay %}
							<td width="15%">已付款</td>
                            <td width="15%"><a href="#" class="oper_btn">查看物流</a></td>

                            {% else %}
							<td width="15%"><a href="/user/order/pay{{ g.oid }}" class="oper_btn">去付款</a></td>
                        {% endif %}
						</tr>
					</tbody>
				</table>
            {% endfor %}

			<div class="pagenation">
                <a href="/user/order1/">首页</a>
                {%if pages.has_previous%}
				    <a href="/user/order{{ pages.number|add:-1 }}"><上一页</a>
                {% else %}
                    <a href="" class="active"><上一页</a>
                {% endif %}
                {% for index in pages.paginator.page_range %}
                    {%if index == pages.number%}
				<a href="#" class="active">{{index}}</a>
                        {% else %}
				<a href="/user/order_{{ index }}/">{{ index }}</a>
				    {% endif %}
                {% endfor %}

            {% if pages.has_next %}
				<a href="/user/order{{ pages.number|add:1 }}">下一页></a>
                {% else %}
                <a href="" class="active">下一页></a>
            {% endif %}
             <a href="/user/order{{ pages.paginator.num_pages }}/">末页</a>
			</div>
        {% else %}
            暂无订单信息
        {% endif %}

		</div>
    </div>


{%endblock content_div%}